package o;

import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable;
import o.zj.b;

public final class zi implements zj, zm {
    private volatile zm ˊ;
    @GuardedBy("requestLock")
    private b ˋ = b.CLEARED;
    private final Object ˎ;
    private volatile zm ˏ;
    @Nullable
    private final zj ॱ;
    @GuardedBy("requestLock")
    private b ᐝ = b.CLEARED;

    public zi(Object obj, @Nullable zj zjVar) {
        this.ˎ = obj;
        this.ॱ = zjVar;
    }

    public void ˎ(zm zmVar, zm zmVar2) {
        this.ˏ = zmVar;
        this.ˊ = zmVar2;
    }

    public void ˏ() {
        synchronized (this.ˎ) {
            if (this.ˋ != b.RUNNING) {
                this.ˋ = b.RUNNING;
                this.ˏ.ˏ();
            }
        }
    }

    public void ॱ() {
        synchronized (this.ˎ) {
            this.ˋ = b.CLEARED;
            this.ˏ.ॱ();
            if (this.ᐝ != b.CLEARED) {
                this.ᐝ = b.CLEARED;
                this.ˊ.ॱ();
            }
        }
    }

    public void ˊ() {
        synchronized (this.ˎ) {
            if (this.ˋ == b.RUNNING) {
                this.ˋ = b.PAUSED;
                this.ˏ.ˊ();
            }
            if (this.ᐝ == b.RUNNING) {
                this.ᐝ = b.PAUSED;
                this.ˊ.ˊ();
            }
        }
    }

    public boolean ˋ() {
        boolean z;
        synchronized (this.ˎ) {
            z = this.ˋ == b.RUNNING || this.ᐝ == b.RUNNING;
        }
        return z;
    }

    public boolean ˎ() {
        boolean z;
        synchronized (this.ˎ) {
            z = this.ˋ == b.SUCCESS || this.ᐝ == b.SUCCESS;
        }
        return z;
    }

    public boolean ॱॱ() {
        boolean z;
        synchronized (this.ˎ) {
            z = this.ˋ == b.CLEARED && this.ᐝ == b.CLEARED;
        }
        return z;
    }

    public boolean ˏ(zm zmVar) {
        if (!(zmVar instanceof zi)) {
            return false;
        }
        zi ziVar = (zi) zmVar;
        if (this.ˏ.ˏ(ziVar.ˏ) && this.ˊ.ˏ(ziVar.ˊ)) {
            return true;
        }
        return false;
    }

    public boolean ˎ(zm zmVar) {
        boolean z;
        synchronized (this.ˎ) {
            z = ʻ() && ॱॱ(zmVar);
        }
        return z;
    }

    @GuardedBy("requestLock")
    private boolean ʻ() {
        return this.ॱ == null || this.ॱ.ˎ(this);
    }

    public boolean ˋ(zm zmVar) {
        boolean z;
        synchronized (this.ˎ) {
            z = ʽ() && ॱॱ(zmVar);
        }
        return z;
    }

    public boolean ˊ(zm zmVar) {
        boolean z;
        synchronized (this.ˎ) {
            z = ᐝ() && ॱॱ(zmVar);
        }
        return z;
    }

    @GuardedBy("requestLock")
    private boolean ᐝ() {
        return this.ॱ == null || this.ॱ.ˊ(this);
    }

    @GuardedBy("requestLock")
    private boolean ʽ() {
        return this.ॱ == null || this.ॱ.ˋ(this);
    }

    @GuardedBy("requestLock")
    private boolean ॱॱ(zm zmVar) {
        return zmVar.equals(this.ˏ) || (this.ˋ == b.FAILED && zmVar.equals(this.ˊ));
    }

    public boolean ʼ() {
        boolean z;
        synchronized (this.ˎ) {
            z = ॱˊ() || ˎ();
        }
        return z;
    }

    @GuardedBy("requestLock")
    private boolean ॱˊ() {
        return this.ॱ != null && this.ॱ.ʼ();
    }

    public void ॱ(zm zmVar) {
        synchronized (this.ˎ) {
            if (zmVar.equals(this.ˏ)) {
                this.ˋ = b.SUCCESS;
            } else if (zmVar.equals(this.ˊ)) {
                this.ᐝ = b.SUCCESS;
            }
            if (this.ॱ != null) {
                this.ॱ.ॱ(this);
            }
        }
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void ʽ(o.zm r4) {
        /*
        r3 = this;
        r1 = r3.ˎ;
        monitor-enter(r1);
        r0 = r3.ˊ;	 Catch:{ all -> 0x002f }
        r0 = r4.equals(r0);	 Catch:{ all -> 0x002f }
        if (r0 != 0) goto L_0x0020;
    L_0x000b:
        r0 = o.zj.b.FAILED;	 Catch:{ all -> 0x002f }
        r3.ˋ = r0;	 Catch:{ all -> 0x002f }
        r0 = r3.ᐝ;	 Catch:{ all -> 0x002f }
        r2 = o.zj.b.RUNNING;	 Catch:{ all -> 0x002f }
        if (r0 == r2) goto L_0x001e;
    L_0x0015:
        r0 = o.zj.b.RUNNING;	 Catch:{ all -> 0x002f }
        r3.ᐝ = r0;	 Catch:{ all -> 0x002f }
        r0 = r3.ˊ;	 Catch:{ all -> 0x002f }
        r0.ˏ();	 Catch:{ all -> 0x002f }
    L_0x001e:
        monitor-exit(r1);	 Catch:{ all -> 0x002f }
    L_0x001f:
        return;
    L_0x0020:
        r0 = o.zj.b.FAILED;	 Catch:{ all -> 0x002f }
        r3.ᐝ = r0;	 Catch:{ all -> 0x002f }
        r0 = r3.ॱ;	 Catch:{ all -> 0x002f }
        if (r0 == 0) goto L_0x002d;
    L_0x0028:
        r0 = r3.ॱ;	 Catch:{ all -> 0x002f }
        r0.ʽ(r3);	 Catch:{ all -> 0x002f }
    L_0x002d:
        monitor-exit(r1);	 Catch:{ all -> 0x002f }
        goto L_0x001f;
    L_0x002f:
        r0 = move-exception;
        monitor-exit(r1);	 Catch:{ all -> 0x002f }
        throw r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: o.zi.ʽ(o.zm):void");
    }
}
